<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .nav{
            text-align: center;
        }
        .nav div{
            display: inline-block;
            color: #ffffff;
            padding: 0 10px;
            line-height: 50px;
        }
    </style>
</head>
<body>
    <div id="box">
  分类      <div style="height: 50px;background: #000000;" class="nav">
            <div>
                <router-link to="/">首页</router-link>
                <a href="#/">首页</a>
            </div>
            <div>
                <router-link to="/no2">分类</router-link>  
                <a href="#/no2">分类</a> 
            </div>
        </div>
        <div style="min-height: 500px;">
            <router-view></router-view>
        </div>
        <div style="height: 150px;background: #000000;"></div>
    </div>
    <template id="no1">
        <div>
            首页
        </div>
    </template>
    <template id="no2">
        <div>
            分类
        </div>
    </template>
</body>
<script src="./vue.js"></script>
<script src="./vue-router.js"></script>
<script>
    //模板
        let no1 ={
            template:'#no1'
        }
        let no2 ={
            template:'#no2'
        }
    // routes
        let routes = [
            {path:'/',name:'index',component:no1},
            {path:'/no2',name:'no2',component:no2},
        ]
    // router 实例
        let router = new VueRouter({
            routes
        })
    // 放到vue实例
    new Vue({
        el:"#box",
        router
    })
</script>
</html>